/*
 * @Author: chenyuanming
 * @Date: 2022-03-29 09:30:13
 * @LastEditTime: 2022-04-11 22:27:40
 * @LastEditors: LGX
 */
import Containerbox from './views/containerBox';
import './App.css';
import { Routes, Route,useLocation,Navigate } from 'react-router-dom';
import Login from './views/login/Login';
function App() {
  const x = useLocation()
  console.log(x.pathname);
  const judge = () => {
    if (x.pathname == '/login') {
      return  <Login />
    } else {
     return  data ? <Containerbox /> : <Navigate to='/login' />
    }
    
  }
  const data = localStorage.getItem('user')
  return (
    <div className="App">
      {
        judge()
      }
    </div>
  );
}

export default App;
